package com.sykj.cloud.system.service.impl;

import java.util.List;
import com.sykj.cloud.common.core.utils.DateUtils;
import com.sykj.cloud.common.core.utils.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sykj.cloud.system.mapper.OrganizationMapper;
import com.sykj.cloud.system.domain.Organization;
import com.sykj.cloud.system.service.IOrganizationService;

/**
 * 组织机构Service业务层处理
 *
 * @author mr.will
 * @date 2021-03-15
 */
@Service
public class OrganizationServiceImpl implements IOrganizationService
{
    @Autowired
    private OrganizationMapper organizationMapper;

    /**
     * 新增组织机构
     *
     * @param organization 组织机构
     * @return 结果
     */
    @Override
    public int insertOrganization(Organization organization)
    {
        organization.setGuid(IdUtils.fastSimpleUUID());
        organization.setCreateTime(DateUtils.getNowDate());


        return organizationMapper.insertOrganization(organization);
    }

    /**
     * 修改组织机构
     *
     * @param organization 组织机构
     * @return 结果
     */
    @Override
    public int updateOrganization(Organization organization)
    {
        organization.setUpdateTime(DateUtils.getNowDate());
        return organizationMapper.updateOrganization(organization);
    }

    /**
     * 批量删除组织机构
     *
     * @param guids 需要删除的组织机构ID
     * @return 结果
     */
    @Override
    public int deleteOrganizationByIds(String[] guids)
    {
        return organizationMapper.deleteOrganizationByIds(guids);
    }

    /**
     * 删除组织机构信息
     *
     * @param guid 组织机构ID
     * @return 结果
     */
    @Override
    public int deleteOrganizationById(String guid)
    {
        return organizationMapper.deleteOrganizationById(guid);
    }



    /**
     * 查询组织机构
     *
     * @param guid 组织机构ID
     * @return 组织机构
     */
    @Override
    public Organization getOrganizationById(String guid)
    {
        return organizationMapper.getOrganizationById(guid);
    }

    /**
     * 查询组织机构列表
     *
     * @param organization 组织机构
     * @return 组织机构
     */
    @Override
    public List<Organization> listOrganizations(Organization organization)
    {
        return organizationMapper.listOrganizations(organization);
    }


}
